#include <REGX52.H>
#include "ADchange.h"
#include "LCD1602.h"

unsigned int Read_data(unsigned char Command)
{
	unsigned int message=0;
	unsigned char i=0;
	DCLK=0;
	CS=0;
	
	for(i=0; i<8; i++)//写入命令操作
	{
		DIN=Command&(0x80>>i);
		DCLK=1;
		DCLK=0;
	}
	
	if(Command&0x08!=0)//8位分辨率
	{
		for(i=0; i<8; i++)//读取数据
		{
			DCLK=1;
			DCLK=0;
			if(DOUT)
			{
				message=message|(0x80>>i);
			}
		}
	}
	
	else//12位分辨率
	{
		
		for(i=0; i<12; i++)//读取数据
		{
			DCLK=1;
			DCLK=0;
			if(DOUT)
			{
				message=message|(0x800>>i);
			}
		}
	}
	CS=1;
	return message;
}